home *** CD-ROM | disk | FTP | other *** search
/ PCGUIA 127 / PC Guia 127.iso / Software / Utils / GParted Live CD / Bin / gparted-livecd-0.2.2.iso / usr_sqfs / bin / setconsolefont < prev    next >
Encoding:
Text File  |  2004-05-30  |  10.7 KB  |  367 lines

  1. #!/bin/sh
  2. if [ "$TMP" = "" ]; then
  3.   TMP=/var/log/setup/tmp
  4. fi
  5.  
  6. load_font() {
  7.   setfont $*
  8.   if [ ! $? = 0 ]; then
  9.     if [ -r $T_PX/usr/share/kbd/consolefonts/$1 ]; then
  10.       setfont $T_PX/usr/share/kbd/consolefonts/$* 1> /dev/null 2> /dev/null
  11.     elif [ -r $T_PX/usr/lib/kbd/consolefonts/$1 ]; then
  12.       setfont $T_PX/usr/lib/kbd/consolefonts/$* 1> /dev/null 2> /dev/null
  13.     elif [ -r /var/adm/mount/live/usr/lib/kbd/consolefonts/$1 ]; then
  14.       setfont /var/adm/mount/live/usr/lib/kbd/consolefonts/$* 1> /dev/null 2> /dev/null
  15.     else # load default font
  16.       setfont
  17.     fi
  18.   fi
  19. }
  20.  
  21. # Determine effective root path:
  22. if [ -r $TMP/SeTT_PX ]; then
  23.   T_PX="`cat $TMP/SeTT_PX`"
  24. elif [ ! "$1" = "" ]; then
  25.   T_PX=$1
  26. else
  27.   T_PX=/
  28. fi
  29.  
  30. if [ ! "$COLOR" = "off" -o -r $TMP/SeTcolor -o -r /tmp/SeTcolor ]; then # use color menus
  31.   if [ ! "$1" = "" ]; then
  32.     dialog --title "CONSOLE FONT CONFIGURATION" --defaultno --yesno "Would you like to try \
  33. out some custom screen fonts?" 5 60
  34.     if [ $? = 1 ]; then
  35.       exit
  36.     fi
  37.   fi
  38.   REPLY=`mktemp -q $TMP/temp.XXXXXX`
  39.   FONT="161.cp.gz -16"
  40.   while [ 0 ]; do
  41.     dialog --default-item "$FONT" --title "SELECT A SCREEN FONT" --menu "Select one of the following \
  42. custom fonts. If you decide you like it, you can make it your new default \
  43. screen font. You'll be able to try as many of these as you like." 21 65 12 \
  44. "161.cp.gz -16" "" \
  45. "162.cp.gz -16" "" \
  46. "163.cp.gz -16" "" \
  47. "164.cp.gz -16" "" \
  48. "165.cp.gz -16" "" \
  49. "737.cp.gz -16" "" \
  50. "880.cp.gz -16" "" \
  51. "928.cp.gz -16" "" \
  52. "972.cp.gz -16" "" \
  53. "Agafari-12.psfu.gz" "" \
  54. "Agafari-14.psfu.gz" "" \
  55. "Agafari-16.psfu.gz" "" \
  56. "Cyr_a8x14.psfu.gz" "" \
  57. "Cyr_a8x16.psfu.gz" "" \
  58. "Cyr_a8x8.psfu.gz" "" \
  59. "Goha-12.psfu.gz" "" \
  60. "Goha-14.psfu.gz" "" \
  61. "Goha-16.psfu.gz" "" \
  62. "GohaClassic-12.psfu.gz" "" \
  63. "GohaClassic-14.psfu.gz" "" \
  64. "GohaClassic-16.psfu.gz" "" \
  65. "LatArCyrHeb-08.psfu.gz" "" \
  66. "LatArCyrHeb-14.psfu.gz" "" \
  67. "LatArCyrHeb-16+.psfu.gz" "" \
  68. "LatArCyrHeb-16.psfu.gz" "" \
  69. "LatArCyrHeb-19.psfu.gz" "" \
  70. "Mik_8x16.gz" "" \
  71. "alt-8x14.gz" "" \
  72. "alt-8x16.gz" "" \
  73. "alt-8x8.gz" "" \
  74. "altc-8x16.gz" "" \
  75. "aply16.psf.gz" "" \
  76. "arm8.fnt.gz" "" \
  77. "b.fnt.gz" "" \
  78. "c.fnt.gz" "" \
  79. "cp1250.psfu.gz" "" \
  80. "cp850-8x14.psfu.gz" "" \
  81. "cp850-8x16.psfu.gz" "" \
  82. "cp850-8x8.psfu.gz" "" \
  83. "cp857.08.gz" "" \
  84. "cp857.14.gz" "" \
  85. "cp857.16.gz" "" \
  86. "cp865-8x14.psfu.gz" "" \
  87. "cp865-8x16.psfu.gz" "" \
  88. "cp865-8x8.psfu.gz" "" \
  89. "cp866-8x14.psf.gz" "" \
  90. "cp866-8x16.psf.gz" "" \
  91. "cp866-8x8.psf.gz" "" \
  92. "cybercafe.fnt.gz" "" \
  93. "cyr-sun16.psfu.gz" "" \
  94. "default8x16.psfu.gz" "" \
  95. "default8x9.psfu.gz" "" \
  96. "drdos8x14.psfu.gz" "" \
  97. "drdos8x16.psfu.gz" "" \
  98. "drdos8x6.psfu.gz" "" \
  99. "drdos8x8.psfu.gz" "" \
  100. "gr737a-8x8.psfu.gz" "" \
  101. "gr737a-9x14.psfu.gz" "" \
  102. "gr737a-9x16.psfu.gz" "" \
  103. "gr737b-8x11.psfu.gz" "" \
  104. "gr737b-9x16-medieval.psfu.gz" "" \
  105. "gr737c-8x14.psfu.gz" "" \
  106. "gr737c-8x16.psfu.gz" "" \
  107. "gr737c-8x6.psfu.gz" "" \
  108. "gr737c-8x7.psfu.gz" "" \
  109. "gr737c-8x8.psfu.gz" "" \
  110. "gr737d-8x16.psfu.gz" "" \
  111. "gr928-8x16-thin.psfu.gz" "" \
  112. "gr928-9x14.psfu.gz" "" \
  113. "gr928-9x16.psfu.gz" "" \
  114. "gr928a-8x14.psfu.gz" "" \
  115. "gr928a-8x16.psfu.gz" "" \
  116. "gr928b-8x14.psfu.gz" "" \
  117. "gr928b-8x16.psfu.gz" "" \
  118. "greek-polytonic.psfu.gz" "" \
  119. "iso01-12x22.psfu.gz" "" \
  120. "iso01.08.gz" "" \
  121. "iso01.14.gz" "" \
  122. "iso01.16.gz" "" \
  123. "iso02-12x22.psfu.gz" "" \
  124. "iso02.08.gz" "" \
  125. "iso02.14.gz" "" \
  126. "iso02.16.gz" "" \
  127. "iso03.08.gz" "" \
  128. "iso03.14.gz" "" \
  129. "iso03.16.gz" "" \
  130. "iso04.08.gz" "" \
  131. "iso04.14.gz" "" \
  132. "iso04.16.gz" "" \
  133. "iso05.08.gz" "" \
  134. "iso05.14.gz" "" \
  135. "iso05.16.gz" "" \
  136. "iso06.08.gz" "" \
  137. "iso06.14.gz" "" \
  138. "iso06.16.gz" "" \
  139. "iso07.14.gz" "" \
  140. "iso07.16.gz" "" \
  141. "iso07u-16.psfu.gz" "" \
  142. "iso08.08.gz" "" \
  143. "iso08.14.gz" "" \
  144. "iso08.16.gz" "" \
  145. "iso09.08.gz" "" \
  146. "iso09.14.gz" "" \
  147. "iso09.16.gz" "" \
  148. "iso10.08.gz" "" \
  149. "iso10.14.gz" "" \
  150. "iso10.16.gz" "" \
  151. "koi8-14.psf.gz" "" \
  152. "koi8c-8x16.gz" "" \
  153. "koi8r-8x14.gz" "" \
  154. "koi8r-8x16.gz" "" \
  155. "koi8r-8x8.gz" "" \
  156. "koi8r.8x8.psfu.gz" "" \
  157. "koi8u_8x14.psfu.gz" "" \
  158. "koi8u_8x16.psfu.gz" "" \
  159. "koi8u_8x8.psfu.gz" "" \
  160. "lat0-08.psfu.gz" "" \
  161. "lat0-10.psfu.gz" "" \
  162. "lat0-12.psfu.gz" "" \
  163. "lat0-14.psfu.gz" "" \
  164. "lat0-16.psfu.gz" "" \
  165. "lat1-08.psfu.gz" "" \
  166. "lat1-10.psfu.gz" "" \
  167. "lat1-12.psfu.gz" "" \
  168. "lat1-14.psfu.gz" "" \
  169. "lat1-16.psfu.gz" "" \
  170. "lat2-08.psfu.gz" "" \
  171. "lat2-10.psfu.gz" "" \
  172. "lat2-12.psfu.gz" "" \
  173. "lat2-14.psfu.gz" "" \
  174. "lat2-16.psfu.gz" "" \
  175. "lat2a-16.psfu.gz" "" \
  176. "lat4-08.psfu.gz" "" \
  177. "lat4-10.psfu.gz" "" \
  178. "lat4-12.psfu.gz" "" \
  179. "lat4-14.psfu.gz" "" \
  180. "lat4-16+.psfu.gz" "" \
  181. "lat4-16.psfu.gz" "" \
  182. "lat4-19.psfu.gz" "" \
  183. "lat4a-08.psfu.gz" "" \
  184. "lat4a-10.psfu.gz" "" \
  185. "lat4a-12.psfu.gz" "" \
  186. "lat4a-14.psfu.gz" "" \
  187. "lat4a-16+.psfu.gz" "" \
  188. "lat4a-16.psfu.gz" "" \
  189. "lat4a-19.psfu.gz" "" \
  190. "lat5-12.psfu.gz" "" \
  191. "lat5-14.psfu.gz" "" \
  192. "lat5-16.psfu.gz" "" \
  193. "lat7-14.psfu.gz" "" \
  194. "lat7a-14.psfu.gz" "" \
  195. "lat7a-16.psf.gz" "" \
  196. "lat9-08.psf.gz" "" \
  197. "lat9-10.psf.gz" "" \
  198. "lat9-12.psf.gz" "" \
  199. "lat9-14.psf.gz" "" \
  200. "lat9-16.psf.gz" "" \
  201. "lat9u-08.psfu.gz" "" \
  202. "lat9u-10.psfu.gz" "" \
  203. "lat9u-12.psfu.gz" "" \
  204. "lat9u-14.psfu.gz" "" \
  205. "lat9u-16.psfu.gz" "" \
  206. "lat9v-08.psfu.gz" "" \
  207. "lat9v-10.psfu.gz" "" \
  208. "lat9v-12.psfu.gz" "" \
  209. "lat9v-14.psfu.gz" "" \
  210. "lat9v-16.psfu.gz" "" \
  211. "lat9w-08.psfu.gz" "" \
  212. "lat9w-10.psfu.gz" "" \
  213. "lat9w-12.psfu.gz" "" \
  214. "lat9w-14.psfu.gz" "" \
  215. "lat9w-16.psfu.gz" "" \
  216. "m.fnt.gz" "" \
  217. "ml.fnt.gz" "" \
  218. "mod_d.fnt.gz" "" \
  219. "mod_s.fnt.gz" "" \
  220. "mr.fnt.gz" "" \
  221. "mu.fnt.gz" "" \
  222. "r.fnt.gz" "" \
  223. "rl.fnt.gz" "" \
  224. "ro.fnt.gz" "" \
  225. "ruscii_8x16.psfu.gz" "" \
  226. "ruscii_8x8.psfu.gz" "" \
  227. "s.fnt.gz" "" \
  228. "sc.fnt.gz" "" \
  229. "scrawl_s.fnt.gz" "" \
  230. "scrawl_w.fnt.gz" "" \
  231. "sd.fnt.gz" "" \
  232. "sun12x22.psfu.gz" "" \
  233. "t.fnt.gz" "" \
  234. "t850b.fnt.gz" "" \
  235. "tcvn8x16.psf.gz" "" \
  236. "viscii10-8x16.psfu.gz" "" \
  237. 2> $REPLY
  238.     if [ ! $? = 0 ]; then
  239.       load_font
  240.       exit
  241.     fi
  242.     FONT=`cat $REPLY`
  243.     rm -f $REPLY
  244.     load_font $FONT
  245.     dialog --title "SET AS DEFAULT FONT" --yesno "Well, what do you think? \
  246. If you'd like to make this your default font, select YES. You can change \
  247. the default font any time by typing 'setconsolefont' or by editing \
  248. /etc/rc.d/rc.font. If you don't \
  249. like this font, select NO, and you'll be returned to the font selection \
  250. menu. If you decide you want to stick with the default font, hit ESC or \
  251. CANCEL once you get to that menu." 11 60
  252.     if [ $? = 0 ]; then
  253.       cat << EOF > $T_PX/etc/rc.d/rc.font
  254. #!/bin/sh
  255. #
  256. # This selects your default screen font from among the ones in
  257. # /usr/share/kbd/consolefonts.
  258. #
  259. setfont -v $FONT
  260. EOF
  261.       chmod 755 $T_PX/etc/rc.d/rc.font
  262.       exit
  263.     else
  264.       load_font
  265.     fi
  266.   done
  267. else # no color!
  268.   echo
  269.   echo -n "Would you like to try out some custom screen fonts ([y]es, [n]o)? "
  270.   read YESNO;
  271.   if [ "$YESNO" = "n" ]; then
  272.     exit
  273.   fi
  274.   while [ 0 ]; do
  275.     cat << EOF
  276.  
  277. SELECT A SCREEN FONT.  Your choices are:
  278. 161.cp.gz 162.cp.gz 163.cp.gz 164.cp.gz 165.cp.gz 737.cp.gz 880.cp.gz 928.cp.gz
  279. 972.cp.gz Agafari-12.psfu.gz Agafari-14.psfu.gz Agafari-16.psfu.gz
  280. Cyr_a8x14.psfu.gz Cyr_a8x16.psfu.gz Cyr_a8x8.psfu.gz ERRORS.gz Goha-12.psfu.gz
  281. Goha-14.psfu.gz Goha-16.psfu.gz GohaClassic-12.psfu.gz GohaClassic-14.psfu.gz
  282. GohaClassic-16.psfu.gz LatArCyrHeb-08.psfu.gz LatArCyrHeb-14.psfu.gz
  283. LatArCyrHeb-16+.psfu.gz LatArCyrHeb-16.psfu.gz LatArCyrHeb-19.psfu.gz
  284. Mik_8x16.gz alt-8x14.gz alt-8x16.gz alt-8x8.gz altc-8x16.gz aply16.psf.gz
  285. arm8.fnt.gz b.fnt.gz c.fnt.gz cp1250.psfu.gz cp850-8x14.psfu.gz
  286. cp850-8x16.psfu.gz cp850-8x8.psfu.gz cp857.08.gz cp857.14.gz cp857.16.gz
  287. cp865-8x14.psfu.gz cp865-8x16.psfu.gz cp865-8x8.psfu.gz cp866-8x14.psf.gz
  288. cp866-8x16.psf.gz cp866-8x8.psf.gz cybercafe.fnt.gz default8x16.psfu.gz
  289. default8x9.psfu.gz drdos8x14.psfu.gz drdos8x16.psfu.gz drdos8x6.psfu.gz
  290. drdos8x8.psfu.gz gr737a-8x8.psfu.gz gr737a-9x14.psfu.gz gr737a-9x16.psfu.gz
  291. gr737b-8x11.psfu.gz gr737b-9x16-medieval.psfu.gz gr737c-8x14.psfu.gz
  292. gr737c-8x16.psfu.gz gr737c-8x6.psfu.gz gr737c-8x7.psfu.gz gr737c-8x8.psfu.gz
  293. gr737d-8x16.psfu.gz gr928-8x16-thin.psfu.gz gr928-9x14.psfu.gz
  294. gr928-9x16.psfu.gz gr928a-8x14.psfu.gz gr928a-8x16.psfu.gz gr928b-8x14.psfu.gz
  295. gr928b-8x16.psfu.gz iso01.08.gz iso01.14.gz iso01.16.gz iso02.08.gz
  296. iso02.14.gz iso02.16.gz iso03.08.gz iso03.14.gz iso03.16.gz iso04.08.gz
  297. iso04.14.gz iso04.16.gz iso05.08.gz iso05.14.gz iso05.16.gz iso06.08.gz
  298. iso06.14.gz iso06.16.gz iso07.14.gz iso07.16.gz iso08.08.gz iso08.14.gz
  299. iso08.16.gz iso09.08.gz iso09.14.gz iso09.16.gz iso10.08.gz iso10.14.gz
  300. iso10.16.gz koi8-14.psf.gz koi8c-8x16.gz koi8r-8x14.gz koi8r-8x16.gz
  301. koi8r-8x8.gz koi8r.8x8.psfu.gz koi8u_8x14.psfu.gz koi8u_8x16.psfu.gz
  302. koi8u_8x8.psfu.gz lat0-08.psfu.gz lat0-10.psfu.gz lat0-12.psfu.gz
  303. lat0-14.psfu.gz lat0-16.psfu.gz lat1-08.psfu.gz lat1-10.psfu.gz lat1-12.psfu.gz
  304. lat1-14.psfu.gz lat1-16.psfu.gz lat2-08.psfu.gz lat2-10.psfu.gz lat2-12.psfu.gz
  305. lat2-14.psfu.gz lat2-16.psfu.gz lat2a-16.psfu.gz lat4-08.psfu.gz lat4-10.psfu.gz
  306. lat4-12.psfu.gz lat4-14.psfu.gz lat4-16+.psfu.gz lat4-16.psfu.gz lat4-19.psfu.gz
  307. lat4a-08.psfu.gz lat4a-10.psfu.gz lat4a-12.psfu.gz lat4a-14.psfu.gz
  308. lat4a-16+.psfu.gz lat4a-16.psfu.gz lat4a-19.psfu.gz lat5-12.psfu.gz
  309. lat5-14.psfu.gz lat5-16.psfu.gz lat7-16.psfu.gz lat9-08.psf.gz lat9-10.psf.gz
  310. lat9-12.psf.gz lat9-14.psf.gz lat9-16.psf.gz lat9u-08.psfu.gz lat9u-10.psfu.gz
  311. lat9u-12.psfu.gz lat9u-14.psfu.gz lat9u-16.psfu.gz lat9v-08.psfu.gz
  312. lat9v-10.psfu.gz lat9v-12.psfu.gz lat9v-14.psfu.gz lat9v-16.psfu.gz
  313. lat9w-08.psfu.gz lat9w-10.psfu.gz lat9w-12.psfu.gz lat9w-14.psfu.gz
  314. lat9w-16.psfu.gz m.fnt.gz ml.fnt.gz mod_d.fnt.gz mod_s.fnt.gz mr.fnt.gz
  315. mu.fnt.gz r.fnt.gz rl.fnt.gz ro.fnt.gz ruscii_8x16.psfu.gz ruscii_8x8.psfu.gz
  316. s.fnt.gz sc.fnt.gz scrawl_s.fnt.gz scrawl_w.fnt.gz sd.fnt.gz sun12x22.psfu.gz
  317. t.fnt.gz t850b.fnt.gz tcvn8x16.psf.gz viscii10-8x16.psfu.gz
  318.  
  319. EOF
  320.     echo -n "Which font would you like (or ENTER to quit)? "
  321.     read FONT;
  322.     if [ "$FONT" = "" ]; then
  323.       load_font
  324.       echo
  325.       exit
  326.     fi
  327.     if [ ! -r $T_PX/usr/share/kbd/consolefonts/$FONT -a ! -r \
  328.          /var/adm/mount/usr/share/kbd/consolefonts/$FONT ]; then
  329.       cat << EOF
  330.  
  331. Sorry, I couldn't find that font. Try again.
  332.  
  333. EOF
  334.     fi
  335.     load_font $FONT
  336.     cat << EOF
  337.  
  338. SET AS DEFAULT FONT
  339.  
  340. Well, what do you think? If you'd like to make this your default font, select
  341. YES. You can change the default font any time by typing 'setconsolefont' or by 
  342. editing /etc/rc.d/rc.font. If you don't like this font, select NO, and you'll
  343. be able to select a different one. If you decide you want to stick with the
  344. default font, hit RETURN once you return to the font selection menu.
  345.  
  346. EOF
  347.     echo -n "Would you like to have this font loaded by default ([y]es, [n]o)? "
  348.     read DEF
  349.     if [ "$DEF" = "YES" -o "$DEF" = "y" ]; then
  350.       cat << EOF > $T_PX/etc/rc.d/rc.font
  351. #!/bin/sh
  352. #
  353. # This selects your default screen font from among the ones in
  354. # /usr/share/kbd/consolefonts.
  355. #
  356. setfont -v $FONT
  357. EOF
  358.       chmod 755 $T_PX/etc/rc.d/rc.font
  359.       echo
  360.       exit
  361.     else
  362.      load_font
  363.     fi
  364.     echo
  365.   done
  366. fi
  367.